﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using MobileSales.Model.Products;
using MobileSales.Model.Params;
using MobileSales.Model.Exceptions;

namespace MobileSales.Server.Services
{
    [ServiceContract(Namespace = "http://MobileSales.Products")]
    public interface IProductService
    {
        #region Product management

        [OperationContract]
        Product GetProduct(int productId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreProduct(Product product);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void RemoveProduct(int productId);
        [OperationContract]
        IEnumerable<Product> GetProductList();
        [OperationContract]
        IEnumerable<Product> GetProductListByCategory(int categoryId);

        [OperationContract]
        Dictionary<Param, string> GetProductParams(int productId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreProductParams(int productId, Dictionary<Param, string> paramDict);

        [OperationContract]
        IEnumerable<ProductImage> GetProductImages(int productId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreProductImages(int productId, IList<ProductImage> images);

        [OperationContract]
        IEnumerable<Category> GetProductCategories(int productId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreProductCategories(int productId, IList<Category> categories);

        #endregion

        #region Category management

        [OperationContract]
        Category GetCategory(int categoryId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreCategory(Category category);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void RemoveCategory(int categoryId);
        [OperationContract]
        IEnumerable<Category> GetCategoryTree();
        [OperationContract]
        Category GetCategoryTreeByBranch(int branchCategoryId);
        [OperationContract]
        IEnumerable<Category> GetCategoryList(IEnumerable<int> categoryIds);
        [OperationContract]
        Category GetParentCategory(int categoryId);
        [OperationContract]
        IEnumerable<Category> GetChildrenCategories(int categoryId);

        #endregion

        #region Tax management

        [OperationContract]
        IEnumerable<Tax> GetTaxList();
        [OperationContract]
        Tax GetTax(int taxId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreTax(Tax tax);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void RemoveTax(int taxId);

        #endregion

        #region Unit management

        [OperationContract]
        IEnumerable<Unit> GetUnitList();
        [OperationContract]
        Unit GetUnit(int unitId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreUnit(Unit unit);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void RemoveUnit(int unitId);

        #endregion

        #region Product image management
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreProductImage(int productId, MobileSales.Model.Products.ProductImage productImage);

        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteProductImage(int productImageId); 
        #endregion

    }
}
